#include <stdio.h>

int main(int argc, char *argv[])
{
	int n, ans = 0, a, b, t, i, max = 0;

	for (i=1; i<=7; i++) {
		scanf("%d %d", &a, &b);
		t = a + b;
		if (t > 8 && t > max) {
			ans = i;
			max = t;
		}
	}

	printf("%d\n", ans);

	return 0;
}
